/* S6plus61.c  This program generates the O6BS mode 7c264 (U25) subgroup
	       stage (6+6) adder EPROM contents. The contents can be
	       used in all the three 8IPs (ie. Power, Real, & Imaginary
	       cards)                              

Note : When the Subgroup is enabled this PROM logic ignores one of the 
       adder inputs corresponding to G1 to G4(Slot0 to Slot3) outputs (A(6)).
       Thus allowing to produce Subgroup sum outputs.


	       ______        CY7C264(U25)
	      |      |		
       A(6)---| Add  |- A+B (7-bits)
       B(6)---|      |
	   ___|      |
	   ³  |______|
	   SubG


       The input to the PROM is organiz2ed as shown below :

	  X XXXXXX XXXXXX X
	  |   |    |  |_____ carry
    SubGroup  |    input a
	   input b                      
						TP  -6/2/98          */
/*    copied from 			
     O6plus61.c            - Dated : 09 Nov '95 */					
/* *************************************************************  */
/* CY 7C264   POWER,REAL,IMAGINARY     OBS Subgroup     	  */
/* *************************************************************  */
						      
#include "gac.h"

main()
{	unsigned char data,d1,d2,s ;
	int i ;
	FILE *out,*outt;

   clrscr() ;	
   out = fopen("s6plus6.bin","wb");     /* subgroup 6 plus 6 ver 1 */
   outt = fopen("s6plus6.txt","wt");    /* Text 6 plus 6 ver 1     */

fprintf(outt," S6plus61.c  This program generates the O6BS mode 7c264 (U25) subgroup\n"); 
fprintf(outt," stage (6+6) adder 4EPROM contents. The contents can be\n"); 
fprintf(outt," used in all the three 8IPs (ie. Power, Real, & Imaginary cards\n"); 
fprintf(outt," Note : When the Subgroup is enabled this PROM logic ignores one of the \n");
fprintf(outt,"        adder inputs corresponding to G1 to G4(Slot0 to Slot3) outputs (A(6)).\n");
fprintf(outt,"        Thus allowing to produce Subgroup sum outputs.        TP - 6/2/98 \n");

   fprintf(outt," i  : s  , d2  + d1  = data\n" );  
	/*      x xxxx xxxx xxxx  */
   for(i=0;i<=0x1fff;i++)
   {	d1 = i & 0x3f ;
	d2 = (i >> 6) &0x3f ;
	s = (i >> 12) & 0x1;  /* SubGroup enable bit */

	if(s==0) 
	    data = (d1 + d2) & 0x7f ; 
	if(s==1)  /* if subgroup selected */
	    data = d2 ;
	      
	printf("%4x : %1x ,  %2x + %2x =  %2x  \n",i,s,d2,d1,data );  
	fwrite(&data,sizeof(data),1,out);
	fprintf(outt, "%4x : %1x ,  %2x + %2x =  %2x  \n",i,s,d2,d1,data );
   }

   fclose(out) ;
   fclose(outt) ;

}
	 
	
